package com.group4.Servlets;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.group4.DAO.VideoDAO;
import com.group4.DB.User;
import com.group4.DB.Video;

/**
 * Servlet implementation class MainServlet
 */
public class MainServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public MainServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		/*HttpSession session = request.getSession();
		List<VideoDAO> videoList = Video.getAllVideos();
		//List<String> videos = new ArrayList();
		//List<String> links = new ArrayList();
		System.out.println("zumba");
		Map<String, String> videos = new HashMap<String, String>();
		for(int i=0;i<videoList.size();i++){
			//System.out.println("ininininin");
			//videos.add(videoList.get(i).getVideoName());
			//links.add(videoList.get(i).getVideoUrl());
			videos.put(videoList.get(i).getVideoUrl(),	 videoList.get(i).getVideoName());
		}
		session.setAttribute("videos", videos);
		*/
		RequestDispatcher rd = request.getRequestDispatcher("index.jsp");
		rd.forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		//System.out.println("asdasdasdasda");
	}

}
